function [H cost] = modelPredictionAPP2(Y, X, d, W)
%modelPrediction this function peform the prediction of the model using
%feature program parameters and model parameters optimized

    if(isnan(W))
        
       H = nan; 
       cost = nan;
        
    else
        %calculate the features
        [FY, F] = featuresConcatenation(Y, X, d);

        %get the number of examples in the data set
        M = size(F,1);

        %add the intercepet term
        F = [ones(M,1), F];

        %make the linear prediction
        H = F * W;

        %calculate the cost
        cost = (1/(2*M)) * ( sum((H - FY) .^ 2));
    end;


end